package TraditionalTime;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class SimpleDateFormatAPI {
    public static void main(String[] args) throws ParseException {

        Date date = new Date();
        long a = date.getTime();

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss EEE a");
        //参数为日期对象
        String s1 = sdf.format(date);
        //参数为时间毫秒值
        String s2 = sdf.format(a);

        //输出的结果都是一样的当前时间
        System.out.println(s1);
        System.out.println(s2);

/*        //将格式化的字符串
        Date d1 = sdf.parse(s1);
        Date d2 = sdf.parse(s2);

        System.out.println(d1);
        System.out.println(d2);*/
    }

}
